package serverMessage;

import java.math.BigInteger;

import time.LogicalTimeStamp;


/**
 * A server after receiving AskUserPubKey message from
 *  another server replies with UserPubKey
 *  if it knows the public key for the particular username
 */
public class UserPubKey extends ServerMessage{
	private static final long serialVersionUID = 2757946231870381852L;

	// the user
	private String username;
	
	// the user's public key
	private BigInteger public_modulus;
	private BigInteger public_exponent;
	
	// is the username logged in with me?
	private boolean hasAnswer;
	
	public UserPubKey(String username,
			BigInteger modulus,
			BigInteger exponent,
			boolean hasAnser,
			LogicalTimeStamp msgTS) {
		
		super(ServerMessage.USER_PUB_KEY, msgTS);
		this.username = username;
		this.public_modulus = modulus;
		this.public_exponent = exponent;
	}

	public String getUsername() {
		return username;
	}
	public BigInteger getPublic_exponent() {
		return public_exponent;
	}
	public BigInteger getPublic_modulus() {
		return public_modulus;
	}
	public boolean hasAnswer(){
		return hasAnswer;
	}
}
